#pragma once
#include<iostream>
#include<unistd.h>
#include<fcntl.h>
#include"Log.hpp"
using namespace std;

//Log lg;

//对指定的fd设置成非阻塞模式
void SetNonblock(int fd)
{
    int fl=fcntl(fd,F_GETFL);
    if(fl<0)
    {
        cerr<<"fcntl error"<<endl;
        exit(0);
    }
    lg.LogMessage(Info,"set %d been nonblock\n",fd);
    fcntl(fd,F_SETFL,fl|O_NONBLOCK);
}
